//
//  QQAPIManager.m
//  BMHVideoMain
//
//  Created by 陈宪栋 on 2017/3/20.
//  Copyright © 2017年 陈宪栋. All rights reserved.
//

#import "QQAPIManager.h"

@implementation QQApiManager
+(instancetype)sharedManager {
    static dispatch_once_t onceToken;
    static QQApiManager *instance;
    dispatch_once(&onceToken, ^{
        instance = [[QQApiManager alloc] init];
    });
    return instance;
}

#pragma mark - QQApiInterfaceDelegate
/**
 处理来至QQ的请求
 */
- (void)onReq:(QQBaseReq *)req {
    NSLog(@"%@",req);

}

/**
 处理来至QQ的响应
 */
- (void)onResp:(QQBaseResp *)resp {
    switch (resp.type) {
        case ESENDMESSAGETOQQRESPTYPE: {
             SendMessageToQQResp * tmpResp = (SendMessageToQQResp *)resp;
            if (tmpResp.type == ESENDMESSAGETOQQRESPTYPE && [tmpResp.result integerValue] == 0)
            {
                //分享成功
                KPostNotification(KQQShareSUCCESS, nil);
            }else if (tmpResp.type == ESENDMESSAGETOQQRESPTYPE && [tmpResp.result integerValue] == -4)
            {
                //分享失败
            }

            if (_delegate && [_delegate respondsToSelector:@selector(didReceiveSendMessageToQQResp:)]) {
                [_delegate didReceiveSendMessageToQQResp:resp];
            }
            break;
        }
        default: {
            break;
        }
    }
}

/**
 处理QQ在线状态的回调
 */
- (void)isOnlineResponse:(NSDictionary *)response {
    
}
@end
